Skip to content

Allow slow OpenSSH startup during unattended Git verification - #21686

Merged
James Newton-King (JamesNK) merged 1 commit into
mainfrom
jamesnk/fix-openssh-probe-timeout
Nov 4, 2026
Merged

James Newton-King (JamesNK) merged 1 commit into
mainfrom
jamesnk/fix-openssh-probe-timeout

Conversation

@JamesNK

Copy link
Copy Markdown
Member

Description

Unattended configuration-source Git acquisition can reject a valid OpenSSH client when its version process takes more than five seconds to start. Two Windows cases in the CI run for #21572 failed just beyond that cutoff.

Allow up to 30 seconds for version probing while honoring the enclosing acquisition cancellation budget. Preserve executable selection, successful-exit and OpenSSH-banner validation, and BatchMode=yes. Add lifecycle-only debug logging and regression coverage for slow startup, invalid banners, nonzero exits, and cancellation. No new dependencies are required.

This branch starts from main after #21572 merged and contains only the SSH fix, tests, and directly related documentation. Temporary investigation workflow changes and stress tests are excluded.

User-facing usage

For an app with an SSH-backed configuration source, the existing unattended update command is unchanged:

aspire update --yes --non-interactive --use-config-source

Slow OpenSSH initialization no longer fails solely because it exceeds five seconds. The overall acquisition deadline still applies. There are no command syntax, help-text, or output-format changes.

Validation

On this branch, based on the latest main:

dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.GitCommandRunnerTests" --filter-class "*.ConfigSourceServiceTests" --filter-class "*.ConfigurationServiceTests" --filter-class "*.ConfigCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Passed: 391 tests; four Linux-only tests skipped on Windows.

During the investigation, before changing the timeout:

dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method "*.VerifyOpenSshAsync_*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Failed as expected: the deterministic six-second startup case returned TimedOut after 5.099 seconds; the other four cases passed. All five pass with the fix.

After building the fix, the following command passed in 20 repetitions on Windows, totaling 200 cases:

dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-build --no-launch-profile -- --filter-method "*.ConfigureUnattendedSsh_VerifiesOpenSshAndAppliesBatchModeAfterUrlRewrites" --filter-method "*.VerifyOpenSshAsync_*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Cross-platform CI verification passed all 27 Git runner class iterations: three runners per OS and three iterations per runner across Windows, Linux, and macOS. This ran on the temporary investigation branch, before the latest-main refresh, and included the original failing cases, deterministic regressions, and a temporary concurrent-startup harness.

The original flake did not reproduce naturally: 375 isolated and 144 concurrent Windows CI cases passed before the fix. The controlled regression confirms the five-second cutoff failure mode, not the precise cause of the original runner delay. Investigation #21685 is closed.

git diff --check: passed. This new PR's full CI has not yet run.

Security considerations

SSH executable selection, custom-command rejection, OpenSSH-banner and exit-code checks, and BatchMode=yes are unchanged. The version probe remains bounded and honors caller cancellation. Logs contain only elapsed time, exit code, failure kind, and cancellation state, not commands, paths, or captured output.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21686

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21686"

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Tests selector

2 / 100 PR test projects · 4 PR jobs, from 2 changed files.

Selected PR test projects (2 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.Tests/Git/GitCommandRunnerTests.Authentication.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Git/GitCommandRunner.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit f174a07.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the OpenSSH probe timeout changes.

No open issues 🎉

What changed in this PR

This PR makes unattended configuration-source Git acquisition tolerate slow OpenSSH startup while preserving cancellation, executable selection, and authentication safeguards.

Changes:

  • Extends OpenSSH version probing from five to 30 seconds, retaining the enclosing cancellation budget.
  • Extracts probe verification into a testable method and adds lifecycle-only debug logging.
  • Adds regression tests for slow startup, banner validation, nonzero exits, and cancellation, and documents the timeout.
File Description
tests/​Aspire.Cli.Tests/​Git/​GitCommandRunnerTests.Authentication.cs Adds focused OpenSSH verification regression tests.
src/​Aspire.Cli/​Git/​GitCommandRunner.cs Extends the probe timeout and adds verification lifecycle logging.
docs/​specs/​cli-config-sources.md Documents the 30-second probe limit and cancellation behavior.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@JamesNK
James Newton-King (JamesNK) merged commit b19f932 into main Nov 4, 2026
423 of 426 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 4, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

docs_required → proven false positive (no user-facing change). Triggered signals: pr_body_has_cli_flag_mention (evidence: aspire update --yes --non-interactive --use-config-source in the PR body, an existing unchanged command) and pr_body_has_user_facing_section (the "User-facing usage" section states there are no syntax, help-text, or output changes). Changed files are src/Aspire.Cli/Git/GitCommandRunner.cs (OpenSSH version-probe timeout raised from 5s to 30s), a test file, and docs/specs/cli-config-sources.md. A search of src/frontend/src/content/docs/ finds no page mentioning OpenSSH or the probe timeout, so there is nothing to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants